package com.zmn.plat.dubbo;

import com.github.ltsopensource.spring.boot.annotation.EnableJobClient;
import com.zmn.manager.common.database.config.OneMasterMultiSlaveDataSourceConfiguration;
import com.zmn.manager.mq.annotation.EnableMQSend;
import org.apache.dubbo.config.spring.context.annotation.DubboComponentScan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchDataAutoConfiguration;
import org.springframework.boot.autoconfigure.elasticsearch.rest.RestClientAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.annotation.Import;
import org.springframework.transaction.annotation.EnableTransactionManagement;

/**
 * @uthor nowind
 * @since 2018-09-19 15:41
 */
@SpringBootApplication(scanBasePackages = {"com.zmn.plat", "com.zmn.manager.common"},
        exclude = {DataSourceAutoConfiguration.class, ElasticsearchDataAutoConfiguration.class, RestClientAutoConfiguration.class})
@DubboComponentScan(basePackages = "com.zmn.plat.dubbo")
//@EnableElasticsearchRepositories(basePackageClasses = {EsPartSkuWorkRepository.class,})
@EnableJobClient
@EnableTransactionManagement
@Import(value = {OneMasterMultiSlaveDataSourceConfiguration.class})
@EnableMQSend
// @PropertySource(value = "file:/a/config-repo/plat/dubbo.properties", ignoreResourceNotFound = true, encoding = "UTF-8")
public class DubboApplication {

    private final static Logger logger = LoggerFactory.getLogger(DubboApplication.class);

    public static void main(String[] args) {
        try {
            System.setProperty("es.set.netty.runtime.available.processors", "false");
            SpringApplication.run(DubboApplication.class, args);
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
        }
    }
}